﻿namespace ConsoleApp2._0930;
public class Demo
{
    public  void Testprint1()
    {
        int x = int.Parse(Console.ReadLine());
        int y = int.Parse(Console.ReadLine());
        int z = int.Parse(Console.ReadLine());
        int[] numbers = { x, y, z };
        Array.Sort(numbers);
        Console.WriteLine(numbers[0]+","+ numbers[1]+","+ numbers[2]);
    }
    public  void Testprint2()
    {
        int sum = 0;
        for (int i = 0; i <= 100; i++)
        {
            if (i % 10 != 7&& i / 10 != 7)
            {
                sum =sum + i;
                Console.WriteLine(i);
            }
        }
        Console.WriteLine(sum);
    }
    public static void Testprint3()
    {
        for (int i = 1; i <= 9; i++)
        {
            for (int j = 1; j <= i; j++)
            {
                Console.Write(j +"*"+ i +"=="+i*j+" ");
            }
            Console.Write("\n");
        }
    }
    public  void Testprint4()
    {
                Console.WriteLine("1000以内的完数有：");
                for (int num = 2; num <= 1000; num++)
                { 
                    int sum = 0;
                    for (int i = 1; i < num; i++)
                    {
                        if (num % i == 0)
                        {
                            sum += i;
                        }
                    }
                    if (sum == num)
                    {
                        Console.Write(num + " ");
                    } 
                }
                Console.WriteLine(); 
    }
    
    public  void Testprint5()
    {
        Console.Write("请输入一个正整数：");
        int num = int.Parse(Console.ReadLine());
        int count = 0;
        int temp = num;
        while (temp > 0)
        {
            temp /= 10;
            count++;
        }
        Console.WriteLine($"它是 {count} 位数");
        Console.Write("逆序数字：");
        temp = num;
        while (temp > 0)
        {
            Console.Write(temp % 10); 
            temp /= 10; 
        }
    }
    public static void Testprint6()
    {
        Console.Write("请输入菱形的行数（奇数）：");
        Console.WriteLine();
        int n = int.Parse(Console.ReadLine());
        for (int i = 1; i <= (n + 1) / 2; i++)
        {
            for (int j = 1; j <= (n + 1) / 2 - i; j++)
            {
                Console.Write(" ");
            }
            for (int k = 1; k <= 2 * i - 1; k++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }
        for (int i = (n - 1) / 2; i >= 1; i--)
        {
            for (int j = 1; j <= (n + 1) / 2 - i; j++)
            {
                Console.Write(" ");
            }
            for (int k = 1; k <= 2 * i - 1; k++)
            {
                Console.Write("*");
            }
            Console.WriteLine(); 
        }
    }
}